/**
 * 
 */
package cn.ivicar.app.controller.service;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.inject.Inject;

import cn.com.carsmart.ws.model.VehicleSim;
import cn.com.carsmart.ws.service.VehicleSimManager;

/**
 * 管理sim卡和车辆关系
 * @author liurunbin 2017年6月9日 cn.ivicar.app.controller.service
 */
public class RelationService {

	private static transient final Logger LOGGER = LoggerFactory.getLogger(RelationService.class);

	@Inject
	private VehicleSimManager vehicleSimManager;
    /*
    获取iccid
     */
	public String getIccid(Long vehicleId) {
		VehicleSim query = new VehicleSim();
		query.setVehicleId(vehicleId);
		List<VehicleSim> list = vehicleSimManager.listByExample(query);
		if (list == null || list.isEmpty()) {
			return null;
		}
		return list.get(0).getIccid();
	}
    /*
    获取VehicleId
     */
	public Long getVehicleId(String iccid) {
		VehicleSim query = new VehicleSim();
		query.setIccid(iccid);
		List<VehicleSim> list = vehicleSimManager.listByExample(query);
		if (list == null || list.isEmpty()) {
			return null;
		}
		return list.get(0).getVehicleId();
	}

}
